<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>dome1</title>
	<style type="text/css">
		*{margin: 0; padding: 0;box-sizing: border-box;}
		body{padding: 10px;}
		.box1{width: 1000px; border: 1px solid #666; border-radius: 10px; padding: 5px;}
		.box1 ul li{list-style: none; }
		.box2{width: 1000px; margin-top: 30px; border: 1px solid #666; border-radius: 10px; padding: 5px;}
		.box2 p{text-indent:45px;}
	</style>
</head>
<body>
	<div class="box1">
		<ul class="box1-ul">
			<li>日期：<span></span>年<span></span>月<span></span>日</li>
			<li>农历：<span></span></li>
			<li>星期：<span></span></li>
			<li>宜：<span></span></li>
			<li>忌：<span></span></li>
		</ul>
	</div>
	<div class="box2">
		
	</div>
	<script src="./jquery-3.4.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script >
			let myDate = new Date;
			let n = myDate.getFullYear();//获取当前年
			let y = myDate.getMonth()+1;//获取当前月
			let r = myDate.getDate();//获取当前日
			$('.box1-ul li:first span').eq(0).html(n);
			$('.box1-ul li:first span').eq(1).html(y);
			$('.box1-ul li:first span').eq(2).html(r);
			$('.box1-ul li:eq(3) span').css({color:'green'});
			$('.box1-ul li:eq(4) span').css({color:'red'});
			$.ajax({
				type:'get',
				url:'http://v.juhe.cn/calendar/day',
				dataType: 'jsonp',
				data:{
					'date':''+n+'-'+y+'-'+r+'',
					'key':'f3407698eb45b716d7dc32f6c36968e9',
				},
				success:function(d,s,x){
					$('.box1-ul li:eq(1) span').html(d.result.data.lunar);
					$('.box1-ul li:eq(2) span').html(d.result.data.weekday);
					$('.box1-ul li:eq(3) span').html(d.result.data.avoid);
					$('.box1-ul li:eq(4) span').html(d.result.data.suit);
				}
			});
			let xiao=document.querySelector('.box2');
			let sum='一';
			$.ajax({
				type:'get',
				url:'http://v.juhe.cn/joke/content/list.php?sort=&page=2&pagesize=2&time=1418816972&key=4f9c7cf0e605378860dd677f0da9d74f',
				dataType: 'jsonp',
				success:function(d,s,x){
					for(let i in d.result.data){
						if(i==0){
							sum='一'
						}else{
							sum='二'
						}
						let shuju='<div>笑话'+sum+'：<br><p>'+d.result.data[i].content+'<p></div>';
						xiao.innerHTML+=shuju
					}
				}
			})
	</script>
</body>
</html>
